package com.example.structural.mapper;

import com.example.structural.domain.User;
import com.example.structural.vo.CustomUser;
import com.example.structural.vo.ShortUser;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface UtilMapper {
    UtilMapper INSTANCE = Mappers.getMapper(UtilMapper.class);

    ShortUser userToShort(User user);

    @Mapping(source = "username", target = "name")
    @Mapping(source = "phone", target = "mobilePhone")
    @Mapping(source = "password", target = "pwd")
    @Mapping(source = "createTime", target = "time")
    CustomUser userToCustom(User user);
}